#include('header.html', {title: '登录'})

<div id="content-container" class="container">
    <div class="es-section login-section">
        <div class="logon-tab clearfix">
            <a class="active">登录帐号</a>
            <a href="/register">注册帐号</a>
        </div>
        <div class="login-main">
            <form @submit.prevent="login_">
                <div class="form-group mbl">
                    <label class="control-label">帐号</label>
                    <div class="controls">
                        <input class="form-control input-lg" v-model="user.username" placeholder="用户名/邮箱"
                               autofocus="autofocus" required>
                        <!--<p class="form-error-message jq-validate-error" v-show="nameError">请输入密码</p>-->
                    </div>
                </div>
                <div class="form-group mbl">
                    <label class="control-label">密码</label>
                    <div class="controls">
                        <input class="form-control input-lg" v-model="user.password" type="password" placeholder="密码"
                               required>
                        <!--<p class="form-error-message jq-validate-error" v-show="passError">请输入密码</p>-->
                    </div>
                </div>
                <div class="form-group mbl">
                    <div class="controls">
                        <input type="checkbox" v-model="user.remember" checked="checked"> 记住密码
                    </div>
                </div>
                <div class="form-group mbl">
                    <button type="submit" class="btn btn-primary btn-lg btn-block">登录</button>
                </div>
            </form>

            <div class="mbl clearfix">
                <a class="link-primary pull-left" href="/getBack">找回密码</a>
                <a class="link-primary pull-right" href="/register">立即注册</a>
            </div>

            #--
            <div class="line">
                <div class="other_oauth">
                    使用第三方账号直接登录
                </div>
            </div>
            <div class="social-login">
        <span>
          <a href="/login/bind/qq?_target_path=&amp;inviteCode=" class="social-icon social-qq">
            <i class="es-icon es-icon-qq"></i>
          </a>
          <a href="/login/bind/weixinweb?_target_path=&amp;inviteCode=" class="social-icon social-weixin">
            <i class="es-icon es-icon-weixin"></i>
          </a>
        </span>
            </div>
            --#
        </div>
    </div>
</div>
<script type="text/javascript" src="/static/layui/layer/layer.js"></script>
<script>
    var vm = new Vue({
        el: '.login-main',
        data: {
            user: {
                username: null,
                password: null,
                remember: true
            },
            passError: false,
            nameError: false
        },
        methods: {
            login_: function () {
                $.post("/user/login", this.user, function (data) {
                    if (data.success) {
                        #if(redirect != null);
                        location.href = "${redirect}";
                        #else
                        {
                            location.href = "/index";
                        }
                        #end
                    } else {
                        layer.msg(data.msg,{icon:5, time: 1200});
                    }
                });
            },
        }
    });
</script>
#include('footer.html')
